package com.cyan.tools.base;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

public class BasePresenterImpl<T extends BaseView> implements BasePresenter{
    protected CompositeDisposable compositeDisposable;

    protected T mView;
    public BasePresenterImpl(T view) {
        mView = view;
        compositeDisposable = new CompositeDisposable();
    }

    @Override
    public void onResume() {
    }

    protected void addDisposable(Disposable d) {
        if (d == null) {
            return;
        }
        compositeDisposable.add(d);
    }

    @Override
    public void onDestroy() {
        compositeDisposable.dispose();
        compositeDisposable = null;
        mView = null;
    }
}
